#include <stdio.h>
double harmonic_average(double a, double b);

int main(void)
{
    double a, b;
    double ans;

    printf("输入两个double类型的数 (q to quit): ");
    while (scanf("%lf %lf", &a, &b) == 2)
    {
        ans = harmonic_average(a, b);
        printf("调和平均数：%.2lf\n", ans);
        printf("继续输入两个double类型的数 (q to quit): ");
    }
    printf("Bye!\n");

    return 0;
}

double harmonic_average(double a, double b)
{
    return 1 / ((1/a + 1/b)/2);
}